/*-----------------------------------------------------------------------------*/
/* ExternAdmin.java                                                              */
/* external administrator for ecom application                                 */
/* Fabienne Boyer - Didier Donsez may 2006                                     */
/*-----------------------------------------------------------------------------*/
package ecom.client;

import ecom.session.EcomAdminRemote;
import ecom.session.EcomCustomerRemote;
import ecom.cart.CartLocal;
import javax.ejb.EJB;
import javax.transaction.*;
import javax.naming.Context;
import shell.Shell;
//import shell.Shellok;

// RMI administrator for the ecom application.
public class ExternAdmin //extends Shell
{

    int accountId = 0;
    Context initialContext = null;
    UserTransaction utx = null;
    @EJB
    static EcomCustomerRemote ecomCustomerBean;
    @EJB
    static EcomAdminRemote ecomAdminBean;
    @EJB
    static CartLocal cartLocal;

    public static void main(String[] args)// throws EcomAdminException
    {
        try {

            System.out.println("Begining Client...");


            Shell shellAdmin = new Shell(args, ecomCustomerBean, ecomAdminBean, true, cartLocal);

            shellAdmin.run();
            //parseArgs(args);

            // get JNDI initial context
           /* Context initialContext = null;
            try {
            initialContext = new InitialContext();
            } catch (Exception e) {
            System.err.println("Cannot get initial context for JNDI: " + e);
            System.exit(2);
            }
            
            // We want to start transactions from client: get UserTransaction
            UserTransaction utx = null;
            try {
            utx = (UserTransaction) initialContext.lookup("UserTransaction");
            } catch (NamingException e) {
            System.err.println("Cannot lookup UserTransaction: " + e);
            System.exit(2);
            }*/

            //ShellContext context = getContext();



            //context.getContext();

        } catch (Exception e) {
            System.err.println("Client get an exception " + e);
            System.exit(2);
        }
    }
    /**
     * Parses an argument list for an acountId
     *
     * @param args[]            String array of arguments
     */
    /*static void parseArgs(String args[]) {
    System.out.println("ParseArgs not yet implemented");
    
    
    
    
    
    
    }*/
}
